package com.linx.common.mybatis.utils;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.lang.annotation.Annotation;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class AnnotationUtils {

    /**
     * 获取TableName注解的值
     */
    public  static <T> String getTableNameValue(Class<T> clazz) {
        if (clazz.isAnnotationPresent(TableName.class)) {
            TableName tableName  = clazz.getAnnotation(TableName.class);

            return tableName.value();
        } else {
            return null;
        }
    }

}
